<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
?>
<style text="tyle/css" >
	.t-danger {color:red; font-weight: bold;}
	.t-success {color:green; font-weight: bold;}
</style>

<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	<h4 class="modal-title">库存详情</h4>
</div>

<div class="">
	<table class="table table-hover  table-striped">
	<?php if($model->stock == 1) {?>	
	<thead><tr>
		<th class="col-md-5">房型</th> <th>价格</th> <th>同业价</th> <th>剩余/总数</th>
	</tr></thead>
		<?php $show = 0; ?>
		<?php foreach($model->stockDetail as $key=>$val){ ?> <!-- val ProductRoom-->

			<?php if($val->show>0){ ?>
			<tr>
				<td class="col-md-5"><?= $val->room->name ?>  <?= $val->room->code ?> <?= $val->people ?>人间</td>
				<td>
					<?= $val->price?>
				</td>
				<td>
					<?= $val->inside_price?>
				</td>
				<td> 
					<?php $sur = $val->num-$val->stockNum; ?>
					<font class="<?= empty($sur) ? 't-danger' : 't-success' ?> "><?= $sur ?></font> / <?= empty($val->num) ? 0 : $val->num ?> 
				</td>
			</tr>
			<?php } ?>
		<?php } ?>
		
	<?php }elseif($model->stock == 2){ ?>
	    <thead><tr>
		<th class="col-md-4">房型</th> <th>第1/2价格</th> <th>第1/2同业价</th><th>第3/4价格</th><th>第3/4同业价</th> <th>剩余/总数</th>
		</tr></thead>
		<?php 
			if(isset($model->stockDetail ) && $model->stockDetail ){
			foreach($model->stockDetail as $key=>$val){ ?>
			<tr>
				<td class="col-md-3"><?= $val['name'] ?></td>
				<td><?= $val['price'] ?></td>
				<td><?= $val['inside_price'] ?></td>
				<td><?= $val['price2'] ?></td>
				<td><?= $val['inside_price2'] ?></td>
				<td>
					<?php $sur = $val['num']-$model->getSellStockRoom($key); ?>
					<font  class="<?= empty($sur) ? 't-danger' : 't-success' ?> "><?= $sur ?></font> / <?= $val['num'] ?> 
				</td>
			</tr>
		<?php } } ?>
	<?php } ?>
	</table>
</div>

